#include<iostream>
#include<vector>
#include<functional>
using namespace std;

class CTest
{
public:
	CTest(int i) : value(i){}
	
	CTest(const CTest& r) = delete;
	CTest& operator=(const CTest& r) = delete;
	
	CTest(CTest&& rr)
	{
		cout<< "CTest move constructor.\n";
		value = rr.value;
		rr.value = -1;
	}
	CTest& operator=(CTest&& rr)
	{
		cout<< "CTest move assignment.\n";
		value = rr.value;
		rr.value = -1;
		
		return *this;
	}
	friend ostream& operator<<(ostream& out, const CTest& r)
	{
		out<< r.value;
		return out;
	}
private:
	int value;
};

int main(void)
{
	CTest t1(100);
	CTest t2(200);
	
	//swap will call move constructor and move assignment if provided, else you should provide
	//copy constructor and copy assignment
	swap(t1, t2);
	
	cout<< t1 <<endl;
	cout<< t2 <<endl;
}
